home *** CD-ROM | disk | FTP | other *** search
-
-
-
- SEMCTL C Library Procedures SEMCTL
-
-
-
- NNAAMMEE
- semctl - semaphore control operations
-
- SSYYNNOOPPSSIISS
- ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
- ##iinncclluuddee <<ssyyss//iippcc..hh>>
- ##iinncclluuddee <<ssyyss//sseemm..hh>>
-
- iinntt sseemmccttll ((sseemmiidd,, sseemmnnuumm,, ccmmdd,, aarrgg))
- iinntt sseemmiidd,, ccmmdd;;
- iinntt sseemmnnuumm;;
- uunniioonn sseemmuunn {{
- vvaall;;
- ssttrruucctt sseemmiidd__ddss **bbuuff;;
- uusshhoorrtt **aarrrraayy;;
- }} aarrgg;;
-
- DDEESSCCRRIIPPTTIIOONN
- sseemmccttll(()) provides a variety of semaphore control operations
- as specified by _c_m_d.
-
- The following _c_m_ds are executed with respect to the sema-
- phore specified by _s_e_m_i_d and _s_e_m_n_u_m:
-
- GGEETTVVAALL Return the value of _s_e_m_v_a_l (see
- iinnttrroo(2)). {{RREEAADD}}
-
- SSEETTVVAALL Set the value of _s_e_m_v_a_l to _a_r_g._v_a_l.
- {{AALLTTEERR}}
-
- GGEETTPPIIDD Return the value of _s_e_m_p_i_d. {{RREEAADD}}
-
- GGEETTNNCCNNTT Return the value of _s_e_m_n_c_n_t.
- {{RREEAADD}}
-
- GGEETTZZCCNNTT Return the value of _s_e_m_z_c_n_t.
- {{RREEAADD}}
-
- The following _c_m_ds return and set, respectively, every _s_e_m_-
- _v_a_l in the set of semaphores.
-
- GGEETTKKEEYYSS
- Place the partial contents of all semaphore
- entries into the array pointed to by _a_r_g._b_u_f .
-
- GGEETTAALLLL
- Place _s_e_m_v_a_l_s into the array pointed to by
- _a_r_g._a_r_r_a_y. {{RREEAADD}}
-
- SSEETTAALLLL
- Set _s_e_m_v_a_l_s according to the array pointed to by
- _a_r_g._a_r_r_a_y. {{AALLTTEERR}}
-
-
-
- Sprite v1.0 21 November 1987 1
-
-
-
-
-
-
- SEMCTL C Library Procedures SEMCTL
-
-
-
- The following _c_m_ds are also available:
-
- IIPPCC__SSTTAATT Place the current value of each
- member of the data structure asso-
- ciated with _s_e_m_i_d into the struc-
- ture pointed to by _a_r_g._b_u_f. The
- contents of this structure are
- defined in iinnttrroo(2). {{RREEAADD}}
-
- IIPPCC__SSEETT Set the value of the following
- members of the data structure asso-
- ciated with _s_e_m_i_d to the
- corresponding value found in the
- structure pointed to by _a_r_g._b_u_f:
-
-
- sseemm__ppeerrmm..uuiidd
- sseemm__ppeerrmm..ggiidd
- sseemm__ppeerrmm..mmooddee //** oonnllyy llooww 99 bbiittss **//
-
- This _c_m_d can only be executed by a
- process that has an effective user
- ID equal to either that of super-
- user, or to the value of
- sseemm__ppeerrmm..ccuuiidd or sseemm__ppeerrmm..uuiidd in
- the data structure associated with
- _s_e_m_i_d.
-
- IIPPCC__RRMMIIDD Remove the semaphore identifier
- specified by _s_e_m_i_d from the system
- and destroy the set of semaphores
- and data structure associated with
- it. This cmd can only be executed
- by a process that has an effective
- user ID equal to either that of
- super-user, or to the value of
- sseemm__ppeerrmm..ccuuiidd or sseemm__ppeerrmm..uuiidd in
- the data structure associated with
- _s_e_m_i_d.
-
- RREETTUURRNN VVAALLUUEE
- Upon successful completion, the value returned depends on
- _c_m_d as follows:
- GGEETTVVAALL The value of _s_e_m_v_a_l.
- GGEETTPPIIDD The value of _s_e_m_p_i_d.
- GGEETTNNCCNNTT The value of _s_e_m_n_c_n_t.
- GGEETTZZCCNNTT The value of _s_e_m_z_c_n_t.
- All others A value of 0.
- Otherwise, a value of -1 is returned and eerrrrnnoo is set to
- indicate the error.
-
-
-
-
-
- Sprite v1.0 21 November 1987 2
-
-
-
-
-
-
- SEMCTL C Library Procedures SEMCTL
-
-
-
- EERRRROORRSS
- sseemmccttll(()) will fail if one or more of the following are true:
-
- EINVAL _s_e_m_i_d is not a valid semaphore identif-
- ier.
-
- EINVAL _s_e_m_n_u_m is less than zero or greater than
- sseemm__nnsseemmss.
-
- EINVAL _c_m_d is not a valid command.
-
- EACCES Operation permission is denied to the
- calling process (see iinnttrroo(2)).
-
- ERANGE _c_m_d is SSEETTVVAALL or SSEETTAALLLL and the value to
- which _s_e_m_v_a_l is to be set is greater
- than the system imposed maximum.
-
- EPERM _c_m_d is equal to IIPPCC__RRMMIIDD or IIPPCC__SSEETT and
- the effective user ID of the calling
- process is not equal to that of super-
- user, or to the value of sseemm__ppeerrmm..ccuuiidd
- or sseemm__ppeerrmm..uuiidd in the data structure
- associated with _s_e_m_i_d.
-
- EFAULT _a_r_g._b_u_f points to an illegal address.
-
- SSEEEE AALLSSOO
- iinnttrroo(2), sseemmggeett(2), sseemmoopp(2).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Sprite v1.0 21 November 1987 3
-
-
-
-